import request from '@/utils/request'

export function login(data) {
  return request({
    url: '/user/login',
    method: 'post',
    data
  })
}

export function getInfo() {
  return request({
    url: '/ucenter/api/v2/user/current',
    method: 'get'
  })
}
export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}

/**
 * 根据关键字(用户名称)模糊查询用户列表
 * @param {string} keyWord 查询关键字
 * */
export function queryUserList(keyWord) {
  return request({
    url: '/api/v1/user/keyWord',
    method: 'get',
    params: {
      keyWord
    }
  })
}

// 上传数据
export function designSubmit(data) {
  return request({
    url: '/api/v1/shopDesign/manualAdd',
    method: 'post',
    data
  })
}

// 获取数据
export function getDesignApplications(data) {
  return request({
    url: `/api/v1/configProductProgram/programAndSeriesList?belongRegions=${data}`,
    method: 'get'
  })
}
// 根据图纸id获取图纸详情
export function getPictureInfo(id) {
  return request({
    url: `/api/v1/shopDesignPicture/getPictureInfo/${id}`,
    method: 'post'
  })
}

// 图纸结果审核(经销商，客户经理)
export function ConfirmationSubmit(data) {
  return request({
    url: '/api/v1/designPictureMaintain/addMaintainToExamine',
    method: 'post',
    data
  })
}
// 根据项目号获取门店设计基本详情
export function getShopDesign(constCode) {
  return request({
    url: `/api/v1/shopDesign/getShopDesign/${constCode}/info`,
    method: 'get'
  })
}
// 设计任务新增
export function addShopDesignTask(data) {
  return request({
    url: '/api/v1/shopDesignTask/addShopDesignTask',
    method: 'post',
    data
  })
}
// 根据任务ID查询任务全部详情
export function wholeInfo(id) {
  return request({
    url: `/api/v1/shopDesignTask/${id}/wholeInfo`,
    method: 'get'
  })
}
// 根据任务ID查询任务全部详情
export function info(id) {
  return request({
    url: `/api/v1/shopDesignTask/${id}/info`,
    method: 'get'
  })
}
// 根据任务ID查询部分设计任务信息(不含图纸信息)
export function basicsInfo(id) {
  return request({
    url: `/api/v1/shopDesignTask/${id}/basicsInfo`,
    method: 'get'
  })
}
// 设计任务分配
export function taskAllocation(data) {
  return request({
    url: '/api/v1/shopDesignTask/taskAllocation',
    method: 'put',
    data
  })
}
// 设计任务审核
export function taskExamine(data) {
  return request({
    url: '/api/v1/shopDesignTask/taskExamine',
    method: 'put',
    data
  })
}
// 设计任务处理
export function taskHandle(data) {
  return request({
    url: '/api/v1/shopDesignTask/taskHandle',
    method: 'put',
    data
  })
}

// 根据出图明细ID查询基本详情(维护出图区域时使用)
export function getBasicsInfo(id) {
  return request({
    url: `/api/v1/designOutpicDetailTask/getBasicsInfo/${id}`,
    method: 'get'
  })
}
// 根据出图明细ID查询基本详情(维护出图区域时使用)
export function shopDesignChange(id) {
  return request({
    url: `/api/v1/shopDesignChange/${id}/info`,
    method: 'get'
  })
}
// 附件类型及模板配置
export function configAttachmentTemplate(data) {
  return request({
    url: `/api/v1/configAttachmentTemplate/page`,
    method: 'post',
    data
  })
}
// 新增卖场设计区域及面积提报信息
export function addDesignAreaSeries(data) {
  return request({
    url: `/api/v1/shopDesign/addDesignAreaSeries`,
    method: 'post',
    data
  })
}
// 保存并提交门店设计
export function preserveAndCommit(data) {
  return request({
    url: `/api/v1/shopDesign/preserveAndCommit`,
    method: 'post',
    timeout: 180000 * 6,
    data
  })
}
// 根据出图明细ID查询基本详情(维护出图区域时使用)
export function getWoleInfo(id) {
  return request({
    url: `/api/v1/shopDesign/getShopDesign/${id}/wholeInfo`,
    method: 'get'
  })
}
// 根据图纸任务号查询出图品类及数量分页(维护出图区域时使用)
export function getCategoryNumberPageByPicTaskCode(data) {
  return request({
    url: `/api/v1/designOutpicDetailTask/getCategoryNumberPageByPicTaskCode`,
    method: 'post',
    data
  })
}
// 异常新增
export function shopException(data) {
  return request({
    url: `/api/v1/shopException`,
    method: 'post',
    data
  })
}
// 设计任务审核
export function addMaintainToExamine(data) {
  return request({
    url: '/api/v1/designPictureMaintain/addMaintainToExamine',
    method: 'post',
    data
  })
}
// 明细提交
export function detailCommit(data) {
  return request({
    url: '/api/v1/designOutpicDetailTask/detailCommit',
    method: 'post',
    data
  })
}
// 明细审核
export function detailToExamine(data) {
  return request({
    url: '/api/v1/designOutpicDetailTask/detailToExamine',
    method: 'post',
    data
  })
}
// 图纸维护
export function getMaintains(id) {
  return request({
    url: `/api/v1/designPictureMaintain/getMaintains/${id}`,
    method: 'get'
  })
}
